/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sk.tuke.magsa.tools.metamodel.constraints;

import sk.tuke.magsa.tools.metamodel.Type;
import yajco.annotation.Before;
import yajco.annotation.Token;

/**
 *
 * @author M@tej
 */
public class Range extends Constraint{
    private int minValue;
    private int maxValue;
    
    @Before("range")
    public Range(@Token("INT_VALUE")int min, @Token("INT_VALUE")int max) 
    {
        this.minValue = min;
        this.maxValue = max;
    }
    
    public int getMaxValue()
    {
        return this.maxValue;
    }
    
    public int getMinValue()
    {
        return this.minValue;
    }
    
    @Override
    public String toString()
    {
        return "Min length is: " + this.getMinValue()+ " and max length is: " + this.getMaxValue();
    }

    @Override
    public boolean supportsType(Type type) {
        return type.equals(Type.INTEGER) || type.equals(Type.REAL);
    }
    
}
